<?php

namespace IDock\Insurance\ZSIC\Request;

use IDock\Http\RequestFormat;
use IDock\Insurance\ZSIC\Request\AllZSICRequest;
use IDock\Insurance\ZSIC\Response\PolicyPaymentResponse;
use IDock\Printer\NonCar\NonCarInquirySinglePrinter;
use IDock\Visitor\PolicyPaymentVisitor;
use stdClass;

class PolicyPaymentRequest extends AllZSICRequest
{
    public $requestCode = 'payment';

    protected $response = PolicyPaymentResponse::class;

    protected $urlTip = '支付接口';
    /**
     * @var  PolicyPaymentVisitor $visitor
     */
    protected $visitor;

    public function generate(): array
    {

        $data = [
            'base' => [
                'orderNo' => $this->visitor->inquiryNo,
                'vciProposalNo' => $this->visitor->biInquiryNo,
                'tciProposalNo' => $this->visitor->ciInquiryNo,
                'orderAmount' => $this->visitor->argc['orderPrice'] ?? '',
                'bgUrl' => 'https://a.bxt.freeradio.cn/insuranceDockAsy/ZSICPay',
//                'cSlsCde' => '123123',
                'terminal' => 'PC',
                'payCategory' => 'QRCODE',
                'policyHolderName' => $this->visitor->argc['applyName'] ?? '',
            ]
        ];
        if(isset($this->visitor->argc['vciPremium'])){
            $data['base']['vciPremium'] = $this->visitor->argc['vciPremium'] ?? '';
        }
        if(isset($this->visitor->argc['tciPremium'])){
            $data['base']['tciPremium'] = $this->visitor->argc['tciPremium'] ?? '';
        }
        return $data;
    }

    public function getBusinessNo()
    {
        return $this->visitor->argc['businessNo'] ?? '';
    }
}
